<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

    <h:body>
        <ui:composition template="/resources/template/template.xhtml">
            <ui:define name="content">
                <h:form>
                    <p:panel header="Search Bills" >
                        <h:panelGroup>
                            <p:panelGrid columns="5" style="min-width: 100%;">
                                <h:inputText autocomplete="off" id="txtSearch" value="#{inwardStaffPaymentBillController.selectText}"  >
                                        <f:ajax render="tblFee" execute="txtSearch" event="keyup" />
                                    </h:inputText>                                
                                <h:outputLabel value="From Date"/>
                                <p:calendar id="fromDate" value="#{inwardStaffPaymentBillController.fromDate}" navigator="false" pattern="dd MMMM yyyy hh mm a" >
                                    <f:ajax event="dateSelect" execute="tblFee"  render="tblFee toDate fromDate"/>
                                </p:calendar>
                                <h:outputLabel value="To Date"/>
                                <p:calendar id="toDate" value="#{inwardStaffPaymentBillController.toDate}" navigator="false" pattern="dd MMMM yyyy hh mm a" >
                                    <f:ajax event="dateSelect" execute="tblFee"  render="tblFee toDate fromDate"/>
                                </p:calendar>
                                 <p:watermark value="Search by Staff Name" for="txtSearch" />
                            </p:panelGrid>
                        </h:panelGroup>
                        <br/><br/>
                        <p:dataTable   id="tblFee" value="#{inwardStaffPaymentBillController.dueBillFeeReportAll}" var="bf" >
                            <p:column headerText="Doctor">
                                <h:commandLink action="inward_bill_staff_payment" >
                                    <h:outputLabel value="#{bf.staff.person.name}">
                                    </h:outputLabel>
                                    <f:setPropertyActionListener value="#{bf.staff}" target="#{inwardStaffPaymentBillController.currentStaff}"/>
                                </h:commandLink>
                            </p:column>
                            <p:column headerText="Institution">
                                <h:commandLink action="inward_bill_staff_payment" >
                                    <h:outputLabel value="#{bf.institution.name}">
                                    </h:outputLabel>
                                    <f:setPropertyActionListener value="#{bf.staff}" target="#{inwardStaffPaymentBillController.currentStaff}"/>
                                </h:commandLink>
                            </p:column>

                            <p:column headerText="Patient">
                                <h:commandLink action="inward_bill_staff_payment" >
                                    <h:outputLabel value="#{bf.bill.patient.person.nameWithTitle}" rendered="#{bf.bill.patientEncounter eq null}"/>                                    
                                    <h:outputLabel value="#{bf.bill.patientEncounter.patient.person.nameWithTitle}"/>                                    
                                    <f:setPropertyActionListener value="#{bf.staff}" target="#{inwardStaffPaymentBillController.currentStaff}"/>
                                </h:commandLink>
                            </p:column>
                            
                             <p:column headerText="BilledAt">
                                <h:commandLink action="inward_bill_staff_payment" >
                                    <h:outputLabel value="#{bf.bill.createdAt}">
                                    </h:outputLabel>
                                    <f:setPropertyActionListener value="#{bf.staff}" target="#{inwardStaffPaymentBillController.currentStaff}"/>
                                </h:commandLink>
                            </p:column>


                            <p:column headerText="Test" >
                                <h:commandLink action="inward_bill_staff_payment" >
                                    <h:outputLabel value="#{bf.billItem.item.name}" />
                                    <f:setPropertyActionListener value="#{bf.staff}" target="#{inwardStaffPaymentBillController.currentStaff}"/>
                                </h:commandLink>
                            </p:column>

                            <p:column headerText="Charge" >
                                <h:commandLink action="inward_bill_staff_payment" >
                                    <h:outputLabel value="#{bf.feeValue}" />
                                    <f:setPropertyActionListener value="#{bf.staff}" target="#{inwardStaffPaymentBillController.currentStaff}"/>
                                </h:commandLink>
                            </p:column>

                        </p:dataTable>

                    </p:panel>

                </h:form>
            </ui:define>


        </ui:composition>

    </h:body>
</html>
